﻿<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title></title>
	<link href="../../scripts/lib/layui/css/layui.css" rel="stylesheet" />
	<script src="../../scripts/lib/layui/layui.js"></script>
	<style>
		body{
			margin-top:10px;
		}
	</style>
</head>
<body>
	<div class="layui-container">
		<button type="button" class="layui-btn" id="test1">
			<i class="layui-icon">&#xe67c;</i>上传图片
		</button>
	</div>
	<script>
		layui.use(['upload'], function (upload) {
			//执行实例
			var uploadInst = upload.render({
				elem: '#test1' //绑定元素
				//, accept:'audio'
				, exts: 'jpg'
				//, field:'jpg'
				, url: '/upload/' //上传接口
				, done: function (res) {
					//上传完毕回调
				}
				, error: function () {
					//请求异常回调
				}
			});
		})
	</script>
</body>
</html>